<%@ page import="java.util.concurrent.atomic.AtomicInteger" %>
<%@ page import="cn.edu.nhic.dao.UserDao" %>
<%@ page import="cn.edu.nhic.entity.User" %>
<%@ page import="java.util.Date" %>
<%--page 指令元素--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>jsp 脚本元素 </title>
</head>
<body>
<%--申明--%>
<%!
    AtomicInteger counter = new AtomicInteger(0);

    public void counter(){
        // CAS: compare and swap
        counter.getAndAdd(1);
    }

%>
<%--Java脚本元素，也就是Java代码--%>
<%
    counter();
//    AtomicInteger counter = new AtomicInteger(0);
//    UserDao userDao = UserDao.getUserDao();
//    userDao.insertUserDao(new User());
    Date date = new Date();
    out.println(date.toString());
%>

<p>该页面的访问次数：</p>
<%--表达式--%>
<%=
counter.intValue()
%>

</body>
</html>
